package top.lishuoboy.logback;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

/**
 * @author ：lishuoboy
 * @date ：Created in 2021-1-1 20:47
 * @description：
 * @modified By：
 * @version: $
 */
@Slf4j
public class LogbackTest {
    //用@Slf4j了，不过变量名是小写log
//  private static final Logger LOG = LoggerFactory.getLogger(LogbackTest.class);
    
    private static final Logger log2 = LoggerFactory.getLogger("org.springframework.TEST");
    //  指定logback配置文件：  设置vm参数 java -Dlogback.configurationFile=logback.xml chapters.configuration.MyApp1
    //  注意：spring-boot-maven-plugin 打jar包会使 -Dlogback.configurationFile失效。
    public static void main(String[] args) throws InterruptedException {
        long start = System.currentTimeMillis();
        for (int i = 1; i <= 1; i++) {
            log.error("第{}行", i);
            log.warn("第{}行", i);
            log.info("第{}行", i);
            log.debug("第{}行", i);
            log.trace("第{}行", i);
    
            log2.error("log2第{}行", i);
            log2.warn("log2第{}行", i);
            log2.info("log2第{}行", i);
            log2.debug("log2第{}行", i);
            log2.trace("log2第{}行", i);
            
            if (i % 10000 == 0) {
                System.out.println(i);
            }
//            TimeUnit.SECONDS.sleep(1);
        }
        
        long end = System.currentTimeMillis();
        System.out.println((end - start) + "ms");
        
    }
}
